var hfrApp = angular.module('hfrApp', ['ngRoute', 'ui.bootstrap', 'ui.codemirror', 'ngSanitize', 'pascalprecht.translate', 'ngCookies']);
(function() {
	hfrApp.config(['$routeProvider', '$httpProvider', '$controllerProvider',  function($routeProvider, $httpProvider, $controllerProvider) {
		// remember mentioned function for later use
		hfrApp.registerCtrl = $controllerProvider.register;
		
		//Enable cross domain calls
		$httpProvider.defaults.useXDomain = true;

		//Remove the header used to identify ajax call  that would prevent CORS from working
		delete $httpProvider.defaults.headers.common['X-Requested-With'];
	    delete $httpProvider.defaults.headers.post['Content-Type'];
	    delete $httpProvider.defaults.headers.put['Content-Type'];
	    
		$routeProvider
			.when('/login', {
			    templateUrl: "app/views/users/login.html",	    
			  })
			  .when('/dashboard', {
			    templateUrl: "app/views/users/dashboard.html",	    
			  })
			  .when('/profile', {
			    templateUrl: "app/views/users/profile.html",	    
			  })
			  .when('/add-new-site', {
			    templateUrl: "app/views/blogs/add-new-site.html",	    
			  })
			  .when('/add-new-site-wordpress', {
			    templateUrl: "app/views/blogs/add-new-site-wordpress.html",	    
			  })
			  .when('/edit-site-wordpress', {
			    templateUrl: "app/views/blogs/add-new-site-wordpress.html",	    
			  })
			  .when('/add-new-site-blogspot', {
			    templateUrl: "app/views/blogs/add-new-site-blogspot.html",	    
			  })
			  .when('/edit-site-blogspot', {
			    templateUrl: "app/views/blogs/add-new-site-blogspot.html",	    
			  })
			  .when('/edit-topics', {
			    templateUrl: "app/views/blogs/add-topics.html",	    
			  })
			  .when('/add-topics', {
			    templateUrl: "app/views/blogs/add-topics.html",	    
			  })
			  .when('/admin/list-topics', {
			    templateUrl: "app/views/admin/blogs/list-topics.html",	    
			  })
			  .when('/summary', {
			    templateUrl: "app/views/blogs/summary.html",
			  })
			  .when('/edit-site', {
			    templateUrl: "app/views/blogs/edit-site.html",	    
			  })
			  .when('/site-management', {
			    templateUrl: "app/views/blogs/site-management.html",	    
			  })
			  .when('/monitor-posted', {
			    templateUrl: "app/views/sitemaps/monitor-posted.html",	    
			  })
			  .when('/add-sitemap', {
			    templateUrl: "app/views/sitemaps/add-sitemap.html",	    
			  })
			  .when('/edit-sitemap', {
			    templateUrl: "app/views/sitemaps/add-sitemap.html",	    
			  })
			  .when('/get-particular-content', {
			    templateUrl: "app/views/sitemaps/get-particular-content.html",	    
			  })
			  .when('/pick-shared-sitemap', {
			    templateUrl: "app/views/sitemaps/pick-shared-sitemap.html",	    
			  })
			  .otherwise({redirectTo: '/dashboard'});
		
	}]);
	
	hfrApp.config(['$translateProvider', function ($translateProvider) {
		
		// Register a loader for the static files
		// So, the module will search missing translation tables under the specified urls.
		// Those urls are [prefix][langKey][suffix].
		$translateProvider.useStaticFilesLoader({
			prefix: 'app/l10n/',
		    suffix: '.json'
		});
		
	    // Tell the module what language to use by default
	    $translateProvider.preferredLanguage('en_US');
	}]);
	
})();